package discrete.math;

public class MatrixMath {
	private int mrows;
	private int mcolumns;
	public int[] [] lmatrix = new int [21] [21];
	
	public MatrixMath(){
		this(0);
	}
	
	public MatrixMath(int x){
		mrows = x + 1;
		mcolumns = x + 1;
	}

public void autoFill (int mrows, int mcolumns){
	
	for(int j=0; j < mcolumns; j++){
		for(int i=0; i < mrows; i++){	
			if ( j != i && lmatrix[i][j] != 1)
				lmatrix[i][j] = (int)Math.round(Math.random());
			if (lmatrix [i][j] == 1){
				int iSync = i;
				int jSync = j;
				j = iSync;
				i = jSync;
				lmatrix [i][j] = 1;
			}
	}		
		for( int k = 0; k < mcolumns; k++){
			lmatrix[0][k] = 0;
			lmatrix[k][0] = 0;
		}
	}	
}

public void printMatrix (){
	
	for(int j=0; j< mcolumns; j++){
		for(int i=0; i < mrows; i++){
			System.out.print( lmatrix [i] [j] + "\t");
		}
		System.out.print("\n");
	}	
}
public int printSingleValue(int mrows, int mcolumns){
	int value = 0;
	
	value = lmatrix [mrows] [mcolumns];
	
	return value;	
}

public int getMrows() {
	return mrows;
}

public void setMrows(int mrows) {
	this.mrows = mrows;
}

public int getMcolumns() {
	return mcolumns;
}

public void setMcolumns(int mcolumns) {
	this.mcolumns = mcolumns;
}
}


